package com.project.service.impl;

import com.project.bean.ProductBean;
import com.project.mapper.IProductMapper;
import com.project.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ProductServiceImpl implements IProductService {
    @Autowired
    private IProductMapper mapper;

    @Override
    public void update() {
        ProductBean pli = mapper.selectById(1);
        ProductBean pwang = mapper.selectById(1);

        pli.setPrice(pli.getPrice() + 50);
        pwang.setPrice(pwang.getPrice() - 30);

        mapper.updateById(pli);
        mapper.updateById(pwang);
    }
}
